//
//  QitaViewController.m
//  ProJectB_1
//
//  Created by lanou3g on 16/8/12.
//  Copyright © 2016年 yangshukai. All rights reserved.
//

#warning 图片4
#import "QitaViewController.h"

@interface QitaViewController ()

@end

@implementation QitaViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor magentaColor];

    [self json];
    
}

- (void)json {
    NSURL *url = [NSURL URLWithString:@"http://s.budejie.com/topic/list/jingxuan/10/bs0315-iphone-4.3/0-20.json"];
    
    
    NSURLSession *session = [NSURLSession sharedSession];
    
    NSURLSessionTask *task = [session dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
        // 4、解析相关的数据
        if (error == nil) {
            NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
            NSLog(@"%@", dict);
        }
    }];
    
    [task resume];
}

@end
